package net.app.zoneland.platform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.app.zoneland.domain.SysRole;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**
 * @Description
 * @Author LENOVO
 * @CreateTime 2020/12/20 12:59
 * @Version: 1.0
 */
public interface SysRoleMapper extends BaseMapper<SysRole> {

    @Select("<script> " +
            "   select r.* from sys_role r " +
            "   where 1=1 " +
            " <if test ='role.name!=null and role.name.trim() neq \"\"'>" +
            "       and r.name like concat('%',#{role.name},'%')" +
            " </if>" +
            " <if test ='role.perms!=null and role.perms.trim() neq \"\"'>" +
            "       and r.perms = #{role.perms}" +
            " </if>" +
            " <if test ='role.remark!=null and role.remark.trim() neq \"\"'>" +
            "       and r.remark like concat('%',#{role.remark},'%')" +
            " </if>" +
            " <if test ='role.status!=null '>" +
            "       and r.status=role.status " +
            " </if>" +
            " <if test ='role.deleted!=null'>" +
            "       and r.deleted = #{role.deleted}" +
            " </if>" +
            "</script>")
    List<SysRole> list(Page<SysRole> page, SysRole role);

    @Select("<script> " +
            "   select r.name,r.perms,r.remark from sys_role r " +
            "   where r.id in (#{roleIds}) " +
            "</script>")
    List<SysRole> queryByRoleId(String roleIds);

}
